package com.econ.powercloud.ems.common.enums;

/**
 * @Author : zjf
 * @Description : 尖峰平谷电价计算模型
 * @Date : 2022/4/5 8:53
 * @Modified by : zjf
 */
public enum IncomeCalculationType implements EnumMethod{

    NORMAL(1,"尖峰平谷"),
    NOT_USE_SPIKE(2,"峰平谷"),
    ;

    private Integer code;
    private String desc;

    @Override
    public Integer getCode() {
        return code;
    }

    @Override
    public String getDesc() {
        return desc;
    }

    IncomeCalculationType(int code, String desc){
        this.code=code;
        this.desc=desc;
    }

    public static IncomeCalculationType fromCode(int code){
        for(IncomeCalculationType type: IncomeCalculationType.values()){
            if(type.getCode() == code){
                return type;
            }
        }
        return null;
    }

    public static String getDescFromCode(int code){
        for(IncomeCalculationType type: IncomeCalculationType.values()){
            if(type.getCode() == code){
                return type.getDesc();
            }
        }
        return null;
    }
}
